package com.example.demo;

import android.content.Context;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.EditText;
import android.widget.MediaController;
import android.widget.VideoView;

import java.io.BufferedWriter;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;

public class FirstActivity extends AppCompatActivity {
    private EditText edit;
    private VideoView videoView;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_first);
        edit = findViewById(R.id.edit);
        videoView = findViewById(R.id.video);



        videoView.setVideoPath("/mnt/shared/App/family.mp4");
        videoView.start();

        MediaController mediaController = new MediaController(FirstActivity.this);
        videoView.setMediaController(mediaController);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        String inputString = edit.getText().toString();
        sava(inputString);
    }
    public void sava(String inputString){
        FileOutputStream out = null;
        BufferedWriter writer = null;

        try {
            out = openFileOutput("data", Context.MODE_PRIVATE);
            writer = new BufferedWriter(new OutputStreamWriter(out));
            writer.write(inputString);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
